﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using DBSchemaViewer.BackEnd.Entities;

namespace DBSchemaViewer.Business.Controller.Helpers
{
    public class UpdateTableHelper
    {
        public List<int> GetDeletedFields(EntityTable originalTable, EntityTable modifiedTable)
        {
            List<int> lstDeletedFields = new List<int>();

            foreach (var currfield in originalTable.Fields)
            {
                bool found = false;

                //modifiedTable.Fields
                for (int icurr = 0; icurr < modifiedTable.Fields.Count && found == false; icurr++)
                {
                    found = (currfield.InternalID == modifiedTable.Fields[icurr].InternalID);
                }


                if (found == false)
                    lstDeletedFields.Add(currfield.InternalID);
            }

            return lstDeletedFields;
        }
        
    }
}
